package com.ruoyi.web.controller.solidProdution;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.solidProdution.domain.WxfwInfo;
import com.ruoyi.solidProdution.service.IWxfwInfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 危险废物信息Controller
 * 
 * @author ruoyi
 * @date 2021-09-02
 */
@RestController
@RequestMapping("/solidProdution/wxfwInfo")
public class WxfwInfoController extends BaseController
{
    @Autowired
    private IWxfwInfoService wxfwInfoService;

    /**
     * 查询危险废物信息列表
     */
    @PreAuthorize("@ss.hasPermi('solidProdution:wxfwInfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(WxfwInfo wxfwInfo)
    {
        startPage();
        List<WxfwInfo> list = wxfwInfoService.selectWxfwInfoList(wxfwInfo);
        return getDataTable(list);
    }

    /**
     * 导出危险废物信息列表
     */
    @PreAuthorize("@ss.hasPermi('solidProdution:wxfwInfo:export')")
    @Log(title = "危险废物信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(WxfwInfo wxfwInfo)
    {
        List<WxfwInfo> list = wxfwInfoService.selectWxfwInfoList(wxfwInfo);
        ExcelUtil<WxfwInfo> util = new ExcelUtil<WxfwInfo>(WxfwInfo.class);
        return util.exportExcel(list, "危险废物信息数据");
    }

    /**
     * 获取危险废物信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('solidProdution:wxfwInfo:query')")
    @GetMapping(value = "/{wxfwId}")
    public AjaxResult getInfo(@PathVariable("wxfwId") Long wxfwId)
    {
        return AjaxResult.success(wxfwInfoService.selectWxfwInfoById(wxfwId));
    }

    /**
     * 新增危险废物信息
     */
    @PreAuthorize("@ss.hasPermi('solidProdution:wxfwInfo:add')")
    @Log(title = "危险废物信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WxfwInfo wxfwInfo)
    {
        return toAjax(wxfwInfoService.insertWxfwInfo(wxfwInfo));
    }

    /**
     * 修改危险废物信息
     */
    @PreAuthorize("@ss.hasPermi('solidProdution:wxfwInfo:edit')")
    @Log(title = "危险废物信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WxfwInfo wxfwInfo)
    {
        return toAjax(wxfwInfoService.updateWxfwInfo(wxfwInfo));
    }

    /**
     * 删除危险废物信息
     */
    @PreAuthorize("@ss.hasPermi('solidProdution:wxfwInfo:remove')")
    @Log(title = "危险废物信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{wxfwIds}")
    public AjaxResult remove(@PathVariable Long[] wxfwIds)
    {
        return toAjax(wxfwInfoService.deleteWxfwInfoByIds(wxfwIds));
    }
}
